package com.zeta.eduservice.service.impl;

import com.zeta.eduservice.entity.question.EduQuestiongroup;
import com.zeta.eduservice.entity.vo.QuestionGroupVo;
import com.zeta.eduservice.mapper.EduQuestiongroupMapper;
import com.zeta.eduservice.service.EduQuestiongroupService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 习题组 服务实现类
 * </p>
 *
 * @author zeta
 * @param <E>
 * @since 2020-08-24
 */
@Service
public class EduQuestiongroupServiceImpl<E> extends ServiceImpl<EduQuestiongroupMapper, EduQuestiongroup> implements EduQuestiongroupService {


	@Override
	public List<QuestionGroupVo> getAllQuestionByFolderId(String folderId) {
		QueryWrapper<EduQuestiongroup> queryWrapper = new QueryWrapper<EduQuestiongroup>();
		queryWrapper.eq("folderId",folderId);
		List<EduQuestiongroup> selectList = baseMapper.selectList(queryWrapper);
		ArrayList<QuestionGroupVo> arrayList = new ArrayList<>();
			for(EduQuestiongroup i:selectList) {
				QuestionGroupVo questionGroupVo = new QuestionGroupVo();
				BeanUtils.copyProperties(i, questionGroupVo);
				arrayList.add(questionGroupVo);
			}
		return arrayList;
	}

}
